using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for Thumbnail
/// </summary>
public class Thumbnail
{
    string _thumbImgPath;
    string _realImgPath;

    public string ThumbImgPath
    {
        get { return _thumbImgPath; }
        set { _thumbImgPath = value; }
    }

    public string RealImgPath
    {
        get { return _realImgPath; }
        set { _realImgPath = value; }
    }

    public Thumbnail() { }

    public Thumbnail(string thumbImgPath, string realImgPath)
    {
        _thumbImgPath = thumbImgPath;
        _realImgPath = realImgPath;
    }

    public static ArrayList GetThumbs(decimal proID)
    {
        string dir = AppDomain.CurrentDomain.BaseDirectory + @"imgs\floors\" + proID.ToString();
        if (!Directory.Exists(dir)) return null;

        ArrayList thumbs = new ArrayList();
        string[] files = Directory.GetFiles(dir);
        foreach (string f in files)
        {
            string ext = Path.GetExtension(f);
            if ((ext == ".jpg" || ext == ".gif") && f.Contains("_thumbs"))
            {
                string fname = Path.GetFileName(f);
                string thumb = string.Format("imgs/floors/{0}/{1}", proID.ToString(), fname);
                string real = thumb.Replace("_thumbs", "");
                thumbs.Add(new Thumbnail(thumb, real));
            }
        }
        return thumbs;
    }
}
